package com.ruoyi.work.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.page.Pages;
import com.ruoyi.common.core.page.Query;
import com.ruoyi.common.query.QueryTool;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.work.mapper.WorkBillKilnMapper;
import com.ruoyi.work.domain.WorkBillKiln;
import com.ruoyi.work.service.IWorkBillKilnService;

/**
 * 窑烧工单详情Service业务层处理
 * 
 * @author xwj
 * @date 2024-09-10
 */
@Service
public class WorkBillKilnServiceImpl extends ServiceImpl<WorkBillKilnMapper, WorkBillKiln> implements IWorkBillKilnService {
    @Autowired
    private WorkBillKilnMapper workBillKilnMapper;

    /**
     * 查询窑烧工单详情
     * 
     * @param id 窑烧工单详情主键
     * @return 窑烧工单详情
     */
    @Override
    public WorkBillKiln selectWorkBillKilnById(Long id) {
        return workBillKilnMapper.selectWorkBillKilnById(id);
    }

    /**
     * 查询窑烧工单详情列表
     * 
     * @param workBillKiln 窑烧工单详情
     * @return 窑烧工单详情
     */
    @Override
    public List<WorkBillKiln> selectWorkBillKilnList(WorkBillKiln workBillKiln) {
        return workBillKilnMapper.selectWorkBillKilnList(workBillKiln);
    }

    /**
     * 新增窑烧工单详情
     * 
     * @param workBillKiln 窑烧工单详情
     * @return 结果
     */
    @Override
    public WorkBillKiln insertWorkBillKiln(WorkBillKiln workBillKiln) {

      //  workBillKilnMapper.insertWorkBillKiln(workBillKiln);
    save(workBillKiln);
    return workBillKiln;
    }

    /**
     * 修改窑烧工单详情
     * 
     * @param workBillKiln 窑烧工单详情
     * @return 结果
     */
    @Override
    public WorkBillKiln updateWorkBillKiln(WorkBillKiln workBillKiln) {

      //  workBillKilnMapper.updateWorkBillKiln(workBillKiln);
        updateById(workBillKiln);
        return workBillKiln;
    }

    /**
     * 批量删除窑烧工单详情
     * 
     * @param ids 需要删除的窑烧工单详情主键
     * @return 结果
     */
    @Override
    public int deleteWorkBillKilnByIds(Long[] ids) {
        return workBillKilnMapper.deleteWorkBillKilnByIds(ids);
    }

    /**
    * 条件删除
    * @param workBillKiln 窑烧工单详情
    * @return
    */
    @Override
    public int delete(WorkBillKiln workBillKiln) {
        QueryWrapper<WorkBillKiln> qw = new QueryWrapper<>();
        QueryTool.condition(qw, workBillKiln);
        return baseMapper.delete(qw);
    }

    /**
     * mp分页
     * @param workBillKiln 窑烧工单详情
     * @return
     */
    @Override
    public Pages<WorkBillKiln> queryPage(WorkBillKiln workBillKiln) {
        QueryWrapper<WorkBillKiln> qw = new QueryWrapper<>();
        QueryTool.condition(qw, workBillKiln);
        IPage<WorkBillKiln> ipage = new Query<WorkBillKiln>().getPage(workBillKiln);

        IPage<WorkBillKiln> page = this.page(
                ipage,
                qw
        );
        return new Pages<>(page);
    }

    /**
     * 删除窑烧工单详情信息
     * 
     * @param id 窑烧工单详情主键
     * @return 结果
     */
    @Override
    public int deleteWorkBillKilnById(Long id) {
        return workBillKilnMapper.deleteWorkBillKilnById(id);
    }
}
